package com.rtx.edi.platform.express.auth.service.impl;


import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rtx.edi.model.express.auth.dto.PlAuthShopDto;
import com.rtx.edi.model.express.auth.po.PlAuthShop;
import com.rtx.edi.platform.express.auth.mapper.PlAuthShopMapper;
import com.rtx.edi.platform.express.auth.service.PlAuthShopService;

/**
 * 店铺信息维护
 * @author luoqiongli
 *
 */
@Service
public class PlAuthShopServiceImpl extends ServiceImpl<PlAuthShopMapper,PlAuthShop> implements PlAuthShopService {

	@Override
	public void selectPlAuthShop(Page<PlAuthShop> pageParam, PlAuthShop shop) {
		LambdaQueryWrapper<PlAuthShop> query = Wrappers.lambdaQuery();
		query.eq(PlAuthShop::getDeleteflag,"0");
		if(shop!=null) {
			query.like(StringUtils.hasText(shop.getName()),PlAuthShop::getName,shop.getName())
			.eq(shop.getShopid()!=null, PlAuthShop::getShopid, shop.getShopid())
			.eq(shop.getVendorid()!=null,PlAuthShop::getVendorid,shop.getVendorid())
			.eq(shop.getShopcode()!=null,PlAuthShop::getShopcode,shop.getShopcode());
		}
		baseMapper.selectPage(pageParam,query);
		
	}

	@Override
	public Boolean addPlAuthShop(PlAuthShop shop) {
		return baseMapper.addPlAuthShop(shop)==1;

	}

	@Override
	public void delPlAuthShops(List<PlAuthShopDto> list) {
		
		for (PlAuthShopDto dto : list) {
			baseMapper.deleteById(dto.getId());
		}
	}
	


}
